/*
 * @Date: 2022-09-16 11:06:35
 * @LastEditors: YeKe
 * @LastEditTime: 2022-10-08 11:41:52
 * @FilePath: \vue3-template\vite.config.ts
 */
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { join, resolve } from "path";
import AutoImport from "unplugin-auto-import/vite"; // element-ui 自动导入 
import Components from "unplugin-vue-components/vite"; // element-ui 自动导入
import { ElementPlusResolver } from "unplugin-vue-components/resolvers"; // element-ui 自动导入

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],
  envPrefix: ["VITE", "GD"],
  server: {
    port: 3100,
  },
  resolve: {
    alias: [
      {
        find: "@",
        replacement: resolve(__dirname, "./src"),
      },
    ],
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: '@import "@/styles/index.scss";',
      },
    },
  },
});
